package com.ruben.simplethymeleafhtml;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
@SpringBootApplication
public class SimpleThymeleafHtmlApplication {

    @Resource
    private HttpServletRequest request;

    public static void main(String[] args) {
        SpringApplication.run(SimpleThymeleafHtmlApplication.class, args);
    }

    @GetMapping("/")
    public String index() {
        request.setAttribute("paramFromServer", "我是controller中返回的值");
        request.setAttribute("message", "我是后端返回的值");
        return "index";
    }

}
